﻿<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:Controls="clr-namespace:System.Windows.Controls">

    <Style TargetType="{x:Type Controls:TreeViewEx}">
        <Style.Resources>
            <ResourceDictionary />
        </Style.Resources>
        <Setter Property="InsertTemplate">
            <Setter.Value>
                <DataTemplate>
                    <DockPanel Background="Transparent" HorizontalAlignment="Stretch">
                        <Polygon Points="0,0 10,5 0,10" Fill="{Binding InsertionMarkerBrush}" DockPanel.Dock="Left"/>
                        <Polygon Points="0,0 -10,5 0,10" Fill="{Binding InsertionMarkerBrush}" DockPanel.Dock="Right" Margin="0,0,2,0"/>
                        <Rectangle Fill="{Binding InsertionMarkerBrush}" Height="1" DockPanel.Dock="Left"/>
                    </DockPanel>
                </DataTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Panel.Background">
            <Setter.Value>
                <DynamicResource ResourceKey="{x:Static SystemColors.WindowBrushKey}" />
            </Setter.Value>
        </Setter>
        <Setter Property="VirtualizingStackPanel.IsVirtualizing" Value="False" />
        <Setter Property="Border.BorderBrush" Value="#FF828790" />
        <Setter Property="Border.BorderThickness" Value="1" />
        <Setter Property="Control.Padding" Value="1" />
        <Setter Property="TextElement.Foreground">
            <Setter.Value>
                <DynamicResource ResourceKey="{x:Static SystemColors.ControlTextBrushKey}" />
            </Setter.Value>
        </Setter>
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility">
            <Setter.Value>
                <x:Static Member="ScrollBarVisibility.Auto" />
            </Setter.Value>
        </Setter>
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility">
            <Setter.Value>
                <x:Static Member="ScrollBarVisibility.Auto" />
            </Setter.Value>
        </Setter>
        <Setter Property="Control.VerticalContentAlignment">
            <Setter.Value>
                <x:Static Member="VerticalAlignment.Center" />
            </Setter.Value>
        </Setter>
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls:TreeViewEx}">
                    <Border BorderThickness="{TemplateBinding Border.BorderThickness}"
                            BorderBrush="{TemplateBinding Border.BorderBrush}" Name="Bd" SnapsToDevicePixels="True">
                        <ScrollViewer CanContentScroll="True" x:Name="scroller"
                                HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
                                VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
                                Background="{TemplateBinding Panel.Background}"
                                Padding="{TemplateBinding Control.Padding}"
                                SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" 
                                Focusable="False">
                                <ItemsPresenter x:Name="content" DockPanel.Dock="Top" />
                        </ScrollViewer>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="UIElement.IsEnabled" Value="False">
                            <Setter Property="Panel.Background" TargetName="Bd">
                                <Setter.Value>
                                    <DynamicResource ResourceKey="{x:Static SystemColors.ControlBrushKey}" />
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>